<template>
  <div v-show="visible">
    <el-dropdown>
        <el-button type="default">
          <i class="iconfont-page icon-page-shangchuan"></i>数据导出
        </el-button>
        <el-dropdown-menu slot="dropdown">
           <!-- <el-dropdown-item>导出本页</el-dropdown-item> -->
           <el-dropdown-item v-if="exportOption === 'all'">导出全部</el-dropdown-item>
           <el-dropdown-item v-if="exportOption === '1000'">导出前1000条</el-dropdown-item>
        </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>
<script>
import {mapState} from 'vuex'
export default {
    computed: {
      ...mapState(['mySearchResult_mode', 'mySearchResult_cardCount', 'mySearchResult_listCount']),
      visible() {
        if(this.mySearchResult_mode === 'list' && this.mySearchResult_listCount !== 0 || this.mySearchResult_mode === 'card' && this.mySearchResult_cardCount !== 0) {
          return true;
        } else {
          return false;
        }
      },
      exportOption() {
        if(this.mySearchResult_mode === 'list' && this.mySearchResult_listCount > 1000) {
          return '1000';
        }else if(this.mySearchResult_mode === 'card' && this.mySearchResult_cardCount > 1000) {
          return '1000';
        } else {
          return 'all';
        }
      }
    },
    data () {
      return {
      }
    }
  }
</script>
<style  type="text/scss" lang="scss">
</style>